/**
 * 
 */
package com.rio.dandan.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.rio.dandan.dao.UserProfileDao;
import com.rio.dandan.pojo.UserProfile;
import com.rio.dandan.service.UserProfileService;
import com.rio.dandan.util.SecurityUtils;

/**
 * 
 * UserAccountServiceImpl.java
 * 
 * @author 宋陆
 * @version 1.0 2014-5-14
 */
@Service
public class UserProfileServiceImpl implements UserProfileService {


    @Resource
    private UserProfileDao userProfileDao;

    /**
     * @see com.rio.dandan.service.UserProfileService#getUserProfile(java.lang.String)
     */
    @Override
    public UserProfile getUserProfile(String uid) {
        return userProfileDao.getUserProfile(uid);
    }

    /**
     * @see com.rio.dandan.service.UserProfileService#updateBaseInfo(com.rio.dandan.pojo.UserProfile)
     */
    @Override
    public UserProfile updateBaseInfo(UserProfile baseInfo) {
        String uid = SecurityUtils.getCurrUId();
        UserProfile profile = userProfileDao.getUserProfile(uid);
        profile.setNativeCode(baseInfo.getNativeCode());
        profile.setNativeProvince(baseInfo.getNativeProvince());
        profile.setNativeCity(baseInfo.getNativeCity());
        profile.setNativeTown(baseInfo.getNativeTown());
        profile.setLivingCode(baseInfo.getLivingCode());
        profile.setLivingProvince(baseInfo.getLivingProvince());
        profile.setLivingCity(baseInfo.getLivingCity());
        profile.setLivingTown(baseInfo.getLivingTown());
        profile.setStature(baseInfo.getStature());
        profile.setDegree(baseInfo.getDegree());
        profile.setIncome(baseInfo.getIncome());
        profile.setQq(baseInfo.getQq());
        profile.setWeixin(baseInfo.getWeixin());
        profile.setEmail(baseInfo.getEmail());
        profile.setMobile(baseInfo.getMobile());
        userProfileDao.updateUserProfile(profile);
        return profile;
    }

}
